package com.yidu.BusinessParament.controller;

import com.yidu.BusinessParament.entity.Plate;
import com.yidu.BusinessParament.service.PlateService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author :yimeng
 * @date :2022/12/13  15:05
 * @description:some description
 */
@RestController
public class PlateController {
    @Resource
    private PlateService plateService;

    //普通查询所有
    @RequestMapping("selectPlate")
    public Map selectPlate(){
        List<Plate> plateList = plateService.selectPlate();
        Map map = new HashMap();
        map.put("code",0);
        map.put("msg","");
        map.put("count",2);
        map.put("data",plateList);
        return map;
    }

    //查询总数
    @RequestMapping("selectCountPlate")
    public Map selectCountPlate(Plate plate){
        List<Plate> plateList = plateService.selectPlate();
        int i = plateService.selectCountPlate(plate);
        Map map = new HashMap();
        map.put("code",0);
        map.put("msg","");
        map.put("count",i);
        map.put("data",plateList);
        return map;
    }

    //添加数据
    @RequestMapping("insertPlate")
    public int insertPlate(Plate plate){
        return plateService.insertPlate(plate);
    }

    //删除数据
    @RequestMapping("deletePlate")
    public int deletePlate(String plateId){
        return plateService.deletePlate(plateId);
    }

    //修改数据
    @RequestMapping("updatePlate")
    public int updatePlate(Plate plate){
        return plateService.updatePlate(plate);
    }



}
